package roteiro1.sort.bubble;

public class BubbleSort<T> {

	/**
	 * bubble version not generic.
	 * @param array - a array of integer.
	 */
	public static void bubbleSort(Integer array[]){
		int n = array.length;
		
		for(int i=0; i<n; i++){
			for (int j=0; j<= i; j++){
				if (array[j] > array[j+1]){
					swap(array, j);
				}
			}
		}
		
	}

	private static void swap(Integer[] array, int j) {
		int temp = array[j];
		array[j] = array[j+1];
		array[j+1] = temp;
	}
	
	
	public Integer[] bubble(Integer array[]){
		bubble(array);
		return array;
	}
	
	
	
	
	/**
	 * Bubble version Generic.
	 * @param array - T a array generic type.
	 */ 
	public static <T extends Comparable<? super T>> void bubbleSort(T [] array){
		
	}
}
